package com.chilly.comsumer;

import com.chilly.service.IUserService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Start service consumer
 *
 * Created by Chilly Cui on 2020/12/3.
 */
public class Consumer {
    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"classpath:dubbo-consumer.xml"});
        context.start();

        // Obtaining a remote service proxy
        IUserService demoService = (IUserService) context.getBean("userService");

        // Executing remote methods
        String hello = demoService.hello();

        // Display the call result
        System.out.println(hello);
    }
}
